﻿using System;

using Microsoft.WindowsMobile.Telephony;

namespace iPhoneUI.Commands
{
    public class MakeCallCmdLet : ICmdLet
    {
        public MakeCallCmdLet()
        {
        }

        public string PhoneNumber { get; set; }

        public bool IsValid
        {
            get
            {
                return true;
            }
        }

        public void Execute()
        {
            Phone phone = new Phone();

            // if a phone number is supplied use that
            if (string.IsNullOrEmpty(PhoneNumber) == false)
                phone.Talk(PhoneNumber, false);
            // otherise use the device's phone number (voicemail)
            else
                phone.Talk(PhoneInfo.GetPhoneNumber());
        }
    }
}
